home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
68161
/
68161.xpi
/
chrome
/
content
/
sidebar-overlay.js
< prev
next >
Wrap
Text File
|
2010-01-28
|
2KB
|
80 lines
/**
* A class to assist the browser overlay dialog
*
* @class
*/
var TwitOverlay = {
/**
* The service responsible for retrieving and setting preferences
*/
prefService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch2),
/**
* Service used to manipulate XUL dialogs
*/
windowService: Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator),
/**
* Retrieve a preference
*
* @param {String} aName The name of the preference.
* @param {String} aDefault A default value to return if something goes wrong.
* @returns {Mixed} The preference's value or aDefault on error.
* @methodOf TwitOverlay
* @since 1.0
*/
getPref:
function (aName, aDefault) {
try {
var pb = this.prefService;
switch ( pb.getPrefType(aName) ) {
case pb.PREF_STRING:
return pb.getCharPref(aName);
case pb.PREF_BOOL:
return pb.getBoolPref(aName);
case pb.PREF_INT:
return pb.getIntPref(aName);
}
} catch ( e ) { }
return aDefault;
},
/**
* Open TwitKitplus's Preferences window
*
* @methodOf TwitOverlay
* @since 1.0
*/
openPrefs:
function () {
var dialog = this.windowService.getMostRecentWindow("TwitKitplus:Preferences");
if (dialog) {
dialog.focus();
return;
}
openDialog(
"chrome://twitkitplus/content/preferences.xul",
"_blank",
"chrome,titlebar,centerscreen"
);
},
/**
* Open TwitKitplus's About window
*
* @methodOf TwitOverlay
* @since 1.0
*/
openAbout:
function () {
var dialog = this.windowService.getMostRecentWindow("TwitKitplus:About");
if ( dialog ) {
dialog.focus();
return;
}
openDialog(
"chrome://twitkitplus/content/about.xul",
"_blank",
"chrome,titlebar,centerscreen," +
( ( this.getPref("browser.preferences.instantApply", false ) ) ? "dialog=no" : "modal" )
);
}
};